package cn.chair.dao;

import cn.chair.entity.Seat;
import cn.chair.model.admin.SeatResp;
import life.innovation.dao.EntityDaoImpl;
import life.innovation.exception.DataReadException;
import org.springframework.stereotype.Repository;

import javax.sql.DataSource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class SeatDao extends EntityDaoImpl<Seat>{

    public SeatDao(DataSource dataSource) {
        super(dataSource, Seat.class);
    }


    public List<SeatResp> getSeats(int merchantId) throws DataReadException {

        Map<String,Object> params = new HashMap<>();

        params.put("merchantId",merchantId);
        return find("db/sql/seat/getSeatByMerchantId.sql",SeatResp.class,params);
    }
}
